package com.openx.xoj.mapper;

import com.openx.xoj.model.Teacher.Examination;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface ExaminationMapper {
    // 插入考试信息并返回生成的考试ID
    int insertExamination(Examination examination);

    @Select("select * from examination")
    List<Examination> findAll();

    int deleteExaminationById(@Param("id") Integer id);

    @Update("UPDATE examination SET courseName = #{courseName}, title = #{title}, description = #{description}, dueDate = #{dueDate}, scoreWeight = #{scoreWeight}, isPublic = #{isPublic}, password = #{password} WHERE id = #{id}")
    int updateExamination(Examination examination);

    int getLastExaminationId();
}
